package com.ms.oschina.util;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;

public class LocalBroadcastUtils {
	public static void sendBroad(Intent intent) {
		LocalBroadcastManager.getInstance(UiUtils.getContext()).sendBroadcast(
				intent);
	}

	public static void registerReceiver(IntentFilter intentFilter,
			BroadcastReceiver receiver) {
		LocalBroadcastManager broadcastManager = LocalBroadcastManager
				.getInstance(UiUtils.getContext());
		broadcastManager.registerReceiver(receiver, intentFilter);
	}

	public static void unRegisterReceiver(BroadcastReceiver receiver) {
		LocalBroadcastManager broadcastManager = LocalBroadcastManager
				.getInstance(UiUtils.getContext());
		broadcastManager.unregisterReceiver(receiver);
	}
}
